<%@ page import="com.the8thfold.anton.users.Roles; org.codehaus.groovy.grails.plugins.springsecurity.SpringSecurityUtils" %>
<table>
    <tr>
        <th></th>
        <th>Target Name</th>
        <th>Description</th>
    </tr>
    <g:each in="${job.targets.sort{it.ordinal}}" status="targetsIndex" var="targetItem">
        <tr class="${targetsIndex%2 ? 'odd' : 'even'}">
            <td style="width: 63px;">
                <div class="toolbar">
                    <g:if test="${SpringSecurityUtils.ifAllGranted(Roles.ROLE_JOB_ADMIN.toString())}">
                        <nobr>
                        <a class="btn" icon="ui-icon-trash" title="Remove this target from this job." onclick="return confirm('Are you sure?');" href="${createLink(controller: 'job', action: 'deleteTarget', id: targetItem.targetId)}"></a>
                        <a class="btn" icon="ui-icon-arrowthick-1-n" title="Move this target up." href="${createLink(controller: 'job', action: 'upTarget', id: targetItem.targetId)}"></a>
                        <a class="btn" icon="ui-icon ui-icon-arrowthick-1-s" title="Move this target down." href="${createLink(controller: 'job', action: 'downTarget', id: targetItem.targetId)}"></a>
                        </nobr>
                    </g:if>
                </div>
            </td>
            <td>${targetItem.name}</td>
            <td>${targetItem.description}</td>
        </tr>
    </g:each>
</table>